package com.example.mvvmkotlin

import android.os.Bundle
import com.blankj.utilcode.util.LogUtils
import com.example.mvvmkotlin.databinding.FragmentTestBinding
import com.fangmu.learn.BaseFragment
import java.util.*

class TestFragment : BaseFragment<FragmentTestBinding>() {
    var a = 0;
    companion object {
        @JvmStatic
        fun newInstance() =
            TestFragment().apply {
                arguments = Bundle().apply {

                }
            }
    }

    override fun initView() {
        binding.btnCreate.text = "sssss"
        val timer = Timer()
        val task = testTask()
        timer.scheduleAtFixedRate(task, 1000, 1000)
    }

    inner class testTask : TimerTask() {
        override fun run() {
            activity?.runOnUiThread {
                binding.btnCreate.text = "" + a
                a++
                LogUtils.e("还在运行$a")
            }
        }
    }
}